package com.soulmate.web.order.vo;

import com.soulmate.order.dto.OrderDTO;
import lombok.Builder;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * 订单VO
 * @author huaiping
 * @date 2/20/23-3:20 PM
 */
@Data
@Builder
public class OrderVO {
    private Long id;
    /**
     * 商品Id
     */
    private Long productId;
    /**
     * 商品数量
     */
    private Integer productQuantity;
    /**
     * 订单金额
     */
    private Integer orderAmount;
    /**
     * 创建用户
     */
    private String createUser;
    /**
     * 创建时间商品
     */
    private LocalDateTime createTime;

    public static OrderVO buildVO(OrderDTO orderDTO) {
        return OrderVO.builder()
                .id(orderDTO.getProductId())
                .orderAmount(orderDTO.getOrderAmount())
                .productId(orderDTO.getProductId())
                .productQuantity(orderDTO.getProductQuantity())
                .createTime(orderDTO.getCreateTime())
                .createUser(orderDTO.getCreateUser())
                .build();
    }
}
